import java.io.*;

public class TestServerProiect {

	public static void main(String args[]) {
		if (args.length < 1) {
			System.out.println("Usage: Server file.cfg");
			return;
		}
		
		
		try {
			BufferedReader br = new BufferedReader( new InputStreamReader( new DataInputStream(new FileInputStream(args[0]))));
			String serverName = br.readLine();
			String serverPort = br.readLine();
			String serverType = br.readLine();
			
			if (serverType.equalsIgnoreCase("UDP")) {
				UDPServer us = new UDPServer(new Integer(serverPort));
				us.serverName = serverName;
				us.start();
				us.join();
			}
			else if (serverType.equalsIgnoreCase("TCP")) {
				TCPServer ts = new TCPServer(new Integer(serverPort));
				ts.serverName = serverName;
				ts.start();
				ts.join();
			}
		
		} catch (Exception e1) {
			e1.printStackTrace();
		}
	}
	
}

